<?php

/**
 * Compania filter form base class.
 *
 * @package    aeropostal
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseCompaniaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'rif'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'codSistF'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nombre'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'descripcion' => new sfWidgetFormFilterInput(),
      'tlf'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'direccion'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'uMedida'     => new sfWidgetFormPropelChoice(array('model' => 'Unidmedida', 'add_empty' => true)),
      'moneda'      => new sfWidgetFormPropelChoice(array('model' => 'Moneda', 'add_empty' => true)),
      'contacto'    => new sfWidgetFormFilterInput(),
      'tlfContacto' => new sfWidgetFormFilterInput(),
      'logotipo'    => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'rif'         => new sfValidatorPass(array('required' => false)),
      'codSistF'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nombre'      => new sfValidatorPass(array('required' => false)),
      'descripcion' => new sfValidatorPass(array('required' => false)),
      'tlf'         => new sfValidatorPass(array('required' => false)),
      'direccion'   => new sfValidatorPass(array('required' => false)),
      'uMedida'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Unidmedida', 'column' => 'simbolo')),
      'moneda'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Moneda', 'column' => 'id')),
      'contacto'    => new sfValidatorPass(array('required' => false)),
      'tlfContacto' => new sfValidatorPass(array('required' => false)),
      'logotipo'    => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('compania_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Compania';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'rif'         => 'Text',
      'codSistF'    => 'Number',
      'nombre'      => 'Text',
      'descripcion' => 'Text',
      'tlf'         => 'Text',
      'direccion'   => 'Text',
      'uMedida'     => 'ForeignKey',
      'moneda'      => 'ForeignKey',
      'contacto'    => 'Text',
      'tlfContacto' => 'Text',
      'logotipo'    => 'Text',
    );
  }
}
